package com.j48.entrancegurad.controller;

import com.j48.entrancegurad.model.Notice;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import com.j48.entrancegurad.service.INoticeService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;

/***
 * 获取小区公告传到前端
 */
@Controller
public class WxNoticeController {
    @Autowired
    private INoticeService noticeService;

    @RequestMapping(value = "/WxNotice" ,produces = "text/html;charset=UTF-8")
    @ResponseBody
    public String SelectNotice(HttpServletRequest request){
        ArrayList<Notice> arrayList=new ArrayList<Notice>();
        arrayList=noticeService.selectAll();
        //System.out.println(net.minidev.json.JSONArray.toJSONString(arrayList));
        return net.minidev.json.JSONArray.toJSONString(arrayList);
    }
}
